import * as types from './mutation-types'

export default {
  [types.SET_PAGE_TITLE](state, title) {
    state.pageTitle = title
  },
  [types.SET_SPLASH_MODE](state, mode) {
    if (state.splashPage !== mode) {
      state.splashPage = mode
    }
  },
  [types.TOGGLE_SNACKBAR](state, opt) {
    let {
      show,
      text,
      color
    } = opt;
    show = show === undefined
    color = color || 'grey darken-4'
    state.snackbarText = text
    state.snackbar = show
    state.snackbarColor = color
  },
  [types.CHANGE_AREACODE](state, payload) {
    state.areaCode = payload.areaCode
  },
  [types.AGENT_ITEM](state, payload) {
    state.agentItem = payload
  },
  [types.PROGRESS](state, payload) {
    state.progress = payload
  },
  [types.PLAYER_ITEM](state, payload) {
    state.playerItem = payload
  },
  [types.PROJECTS](state, payload) {
    state.state_projects = payload
  },
  [types.DEPARTMENTS](state, payload) {
    state.state_departments = payload
  },
  [types.AREAS](state, payload) {
    state.state_areas = payload
  }
}